﻿using Restaurant.DatabaseTools;
using Restaurant.entity;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Restaurant
{
    public partial class CountFrm : Form
    {
        public CountFrm()
        {
            Tools.SetWebBrowserFeatures(11);//设置IE控件版本！！！！！IE11菜支持css3，之前的版本会出错！
            InitializeComponent();
        }

        private void CountFrm_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Left = 0;
            this.Top = 0;
            string urlPath = Environment.CurrentDirectory + "/index.html";
            urlPath = urlPath.Replace("%20", " ");
            webBrowser1.Navigate(urlPath);
            webBrowser1.IsWebBrowserContextMenuEnabled = false; //禁止右键

            for(int i=0;i<SData.db.GDB.Count();i++)
            {
                listBox1.Items.Add(SData.db.GDB[i].itemlistNum);
            }


        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            itemnum.Text = SData.db.GDB[listBox1.SelectedIndex].itemlistNum;
            itempeople.Text = SData.db.GDB[listBox1.SelectedIndex].chargePeople;
            itemprice.Text = SData.db.GDB[listBox1.SelectedIndex].price.ToString();
        }
    }
}
